class Track {
    private from :City;
    private to :City;
    private segmentCount :number;

    constructor(from :City, to :City, segmentCount :number) {
        if (from === undefined || from === null)
            throw ("from parameter may not be undefined or null.");
        if (to === undefined || to === null)
            throw ("to parameter may not be undefined or null.");
        if (segmentCount === undefined || segmentCount === null)
            throw ("segmentCount may not be undefined or null.");
        if (segmentCount < 1 || segmentCount > 6)
            throw ("segmentCount must be between 1 and 6, inclusive.");

        this.from = from;
        this.to = to;
        this.segmentCount = segmentCount;
    }

    getFrom() :City {
        return this.from;
    }

    getTo() :City {
        return this.to;
    }

    getSegmentCount() :number {
        return this.segmentCount;
    }

    getScore() :number {
        return (this.segmentCount === 1) ? 1 :
            (this.segmentCount === 2) ? 2 :
            (this.segmentCount === 3) ? 4 :
            (this.segmentCount === 4) ? 7 :
            (this.segmentCount === 5) ? 10 :
            /*(this.segmentCount === 6) ?*/ 15;
    }
}